package com.example.xxljobaiassistant.controller;

import com.example.xxljobaiassistant.assistant.SeparateChatAssistant;
import com.example.xxljobaiassistant.assistant.SimpleAiAssistant;
import com.example.xxljobaiassistant.dto.ChatRequest;
import dev.langchain4j.community.model.dashscope.QwenChatModel;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.apache.commons.lang3.RandomUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import reactor.core.publisher.Flux;

@RestController
@RequestMapping("/api/assistant")
@Tag(name = "AI助手", description = "XXL-JOB智能助手接口")
public class AssistantController {


    @Autowired
    private QwenChatModel qwenChatModel;

    @Autowired
    private SeparateChatAssistant separationChatAssistant;



    @Operation(summary = "与AI助手对话")
    @PostMapping(value = "/chat", produces = "text/stream;charset=utf-8")
    public Flux<String> chat(@RequestBody ChatRequest request) {
        return separationChatAssistant.chat(request.getMemoryId(), request.getMessage());
    }
}